package com.cqie.tes.utils;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

//2020-10-10 20:23:43.126
//Wed Feb 13 08:00:00 +0800 2012
/**
 * 时间转换工具
 * @author  H
 * */
public class DateUtil {

//    private Long parseTotimestamp(Date date){
//        return date.getTime();
//    }

    /**
     * yyyy-mm-dd => GMT
     * */
    public static String ymdToGMT(Date date){
        long timestamp = date.getTime();
        SimpleDateFormat sf = new SimpleDateFormat("EEE MMM dd hh:mm:ss z yyyy", Locale.ENGLISH);
        return sf.format(timestamp);
    }

//    public static Date gmdToYMD(Date date){
//        long timestamp = date.getTime();
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        return new Date(sdf.format(timestamp));
//    }

    public static void main(String[] args) {
        System.out.println(ymdToGMT(new Date()));

    }
}
